Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce docker image size #165

Merged
merged 2 commits into from
Aug 23, 2023
Merged

Reduce docker image size #165

merged 2 commits into from
Aug 23, 2023

Conversation

rudigiesler
Copy link
Contributor

@rudigiesler rudigiesler commented Aug 23, 2023

Purpose

Reduce startup time by reducing the size of the docker image

Approach

  • Add development dependancies as optional dependancies
  • Don't cache pip downloads in docker image builds
  • Use CPU only pytorch (we don't run on GPUs)

image

@rudigiesler
Copy link
Contributor Author

Before:
image

After:
image

Saved about 2GB from the pip install, by not caching dependencies, and by installing the CPU only version of pytorch

The collectstatic command is still 390MB, but I don't think that's due to static files (only 13MB on my local machine), I think that's due to downloading the pytorch models on import. But on startup those get downloaded again, so we need to figure out how to either exclude them in the image, or to get it to stop redownloading them on startup.

@rudigiesler rudigiesler merged commit 80f209f into main Aug 23, 2023
4 checks passed
@rudigiesler rudigiesler deleted the reduce-docker-image-size branch August 23, 2023 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants